package com.soar.recruitment.module.web.bll.web;

import android.text.TextUtils;
import android.webkit.WebView;

import com.soar.recruitment.module.web.bll.interfaces.OnWebTitleListener;
import com.soar.recruitment.module.web.bll.web.base.BaseWebChromeClient;


public class SOARWebChromeClient extends BaseWebChromeClient {

    private OnWebTitleListener mOnWebTitleListener;

    public SOARWebChromeClient(OnWebTitleListener onWebTitleListener) {
        this.mOnWebTitleListener = onWebTitleListener;
    }

    @Override
    public void onReceivedTitle(WebView view, String title) {
        super.onReceivedTitle(view, title);
        if (TextUtils.isEmpty(title)) {
            return;
        }
        if (mOnWebTitleListener != null) {
            mOnWebTitleListener.onReceivedTitle(title);
        }
    }

    @Override
    public void onProgressChanged(WebView view, int newProgress) {
        super.onProgressChanged(view, newProgress);

        if (mOnWebTitleListener != null) {
            mOnWebTitleListener.progressChanged(newProgress);
        }
    }
}
